﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ListDepartment.aspx.cs" Inherits="SD.Web.Views.Department.ListDepartment" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentTitle" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Content" runat="server">
<asp:UpdatePanel runat="server" ID="UpdatePanelDepartmentList">
        <ContentTemplate>
            <div class="titleh">
            <span class="right">
                        <asp:LinkButton ID="LinkButton1" runat="server" CssClass="hg-blue" 
                            onclick="LinkButtonCreate_Click">In-Active</asp:LinkButton>&nbsp;
                        <asp:LinkButton ID="LinkButton2" runat="server" CssClass="hg-blue" 
                            onclick="LinkButtonCreate_Click">Save</asp:LinkButton>&nbsp;
                        <asp:LinkButton ID="LinkButton3" runat="server" CssClass="hg-blue" 
                            OnClientClick="window.history.go(-1)">Back</asp:LinkButton>
            </span>
            </div>
            <div>
                &nbsp;
            </div>
            <br />
            <div class="titleh">
                <h3 class="sorting_range">
                    <asp:LinkButton ID="LinkButtonAll" runat="server" OnCommand="FilterByLetters_Command"
                        CommandName="all">All</asp:LinkButton>
                    <asp:LinkButton ID="LinkButton09" runat="server" CommandName="09" OnCommand="FilterByLetters_Command">0-9</asp:LinkButton>
                    <asp:LinkButton ID="LinkButtonAE" runat="server" CommandName="ae" OnCommand="FilterByLetters_Command">A B C D E</asp:LinkButton>
                    <asp:LinkButton ID="LinkButtonFJ" runat="server" CommandName="fj" OnCommand="FilterByLetters_Command">F G H I J</asp:LinkButton>
                    <asp:LinkButton ID="LinkButtonKN" runat="server" CommandName="kn" OnCommand="FilterByLetters_Command">K L M N </asp:LinkButton>
                    <asp:LinkButton ID="LinkButtonOR" runat="server" CommandName="or" OnCommand="FilterByLetters_Command">O P Q R</asp:LinkButton>
                    <asp:LinkButton ID="LinkButtonSV" runat="server" CommandName="sv" OnCommand="FilterByLetters_Command">S T U V</asp:LinkButton>
                    <asp:LinkButton ID="LinkButtonWZ" CssClass="last" runat="server" CommandName="wz"
                        OnCommand="FilterByLetters_Command">W X Y Z</asp:LinkButton>
                    <span class="right">
                        <asp:LinkButton ID="LinkButtonCreate" runat="server" CssClass="hg-blue" 
                            onclick="LinkButtonCreate_Click">Create</asp:LinkButton>
                        <asp:CheckBox ID="CheckBoxInactive" runat="server" Text="Include In-active" AutoPostBack="True"
                            OnCheckedChanged="CheckBoxInactive_CheckedChanged" />
                    </span>
                </h3>
            </div>
        
        <asp:GridView ID="GridViewDepartmentList" runat="server" CssClass="tablesorter" AutoGenerateColumns="False"
            DataSourceID="ObjectDataSourceDepartmentList" AllowPaging="True" PageSize="15"
            AllowSorting="True" EmptyDataText="There's no department record." 
                EnableSortingAndPagingCallbacks="True" ShowHeaderWhenEmpty="True" 
                onselectedindexchanging="GridViewDepartmentList_SelectedIndexChanging">
            <columns>
                    <asp:CommandField ShowSelectButton="True" />
                    <asp:TemplateField HeaderText="Department Name" SortExpression="DepartmentName">
                        <ItemTemplate>
                            <asp:HyperLink ID="HyperLink2" runat="server" 
                                NavigateUrl='<%# Bind("DepartmentId","~/Views/Department/EditDepartment.aspx?id={0}") %>' 
                                Text='<%# Bind("DepartmentName") %>'></asp:HyperLink>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("DepartmentName") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <HeaderStyle CssClass="header" HorizontalAlign="Left" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Address Line 1" SortExpression="AddressLine">
                        <ItemTemplate>
                            <%#Eval("Address.AddressLine") %>
                        </ItemTemplate>
                         <HeaderStyle HorizontalAlign="Left" CssClass="header" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Postcode" SortExpression="Postcode">
                        <ItemTemplate>
                            <%#Eval("Address.Postcode") %>
                        </ItemTemplate>
                         <HeaderStyle HorizontalAlign="Left" CssClass="header" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Contact" SortExpression="Surname">
                        <ItemTemplate>
                            <%#Eval("Contact.Surname") %>
                        </ItemTemplate>
                         <HeaderStyle HorizontalAlign="Left" CssClass="header" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Is Active?" SortExpression="IsActive">
                        <ItemTemplate>
                            <%#Eval("IsActive") %>
                            &gt;
                        </ItemTemplate>
                         <HeaderStyle HorizontalAlign="Left" CssClass="header" />
                    </asp:TemplateField>
            </columns>
            <PagerSettings Mode="NextPreviousFirstLast" />
        </asp:GridView>
        </ContentTemplate>
    </asp:UpdatePanel>
    <div class="grid740 simplebox">
        <asp:ObjectDataSource ID="ObjectDataSourceDepartmentList" runat="server" TypeName="SD.Business.DepartmentBUS"
            SelectMethod="ListDepartment" OnSelecting="ObjectDataSourceDepartmentList_Selecting"
            EnablePaging="True" SelectCountMethod="GetListCount" 
            StartRowIndexParameterName="startRowIndex" SortParameterName="sortType">
            <SelectParameters>
                <asp:Parameter Name="filter" Type="Object" ConvertEmptyStringToNull="False"  />
            </SelectParameters>
        </asp:ObjectDataSource>
    </div>
</asp:Content>
